//需求：在编程赛中有6个评委打分，分数为0-100的整数分。选手最后得分为：去掉一个最高分和一个最低分后的4个评委的平均值
package edu.zut.process;
import java.util.Scanner;
public class Array_7 {
    public static void main(String[] args) {
        int[] arr = new int[6];
        Scanner sc = new Scanner(System.in);
        for (int i = 0;i<arr.length;i++){
            System.out.println("请输入第"+(i+1)+"个评委打分");
            int score = sc.nextInt();
            if (score>=0&&score<=100) {
                arr[i] = score;
            }else {
                System.out.println("您的打分有误，请检查是否是0-100之间的");
                i--;
            }
        }
        int max = arr[0];
        for (int i = 0;i<arr.length;i++){
            if (max<arr[i]){
                max = arr[i];
            }
        }
        int min = arr[0];
        for (int i = 0;i<arr.length;i++){
            if (min>arr[i]){
                min = arr[i];
            }
        }
        int sum = 0;
        for (int i = 0;i<arr.length;i++){
            sum += arr[i];
        }
        int avg = (sum-max-min)/4;
        System.out.println(avg);
    }
}
